<div class="container-xl">
  <div class="page-header d-print-none">
    <div class="row align-items-center">
      <div class="col">
        <h2 class="page-title">
          电视剧订阅
        </h2>
      </div>
      <div class="col-auto ms-auto d-print-none">
        <div class="btn-list">
          <a href="javascript:show_add_tvrss_media_modal()" class="btn btn-primary d-none d-sm-inline-block">
            <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
                 stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
              <line x1="12" y1="5" x2="12" y2="19"></line>
              <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
            新增订阅
          </a>
          <a href="javascript:show_add_tvrss_media_modal()" class="btn btn-primary d-sm-none btn-icon">
            <svg xmlns="http://www.w3.org/2000/svg" class="icon" width="24" height="24" viewBox="0 0 24 24"
                 stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
              <line x1="12" y1="5" x2="12" y2="19"></line>
              <line x1="5" y1="12" x2="19" y2="12"></line>
            </svg>
          </a>
          <a href="javascript:navmenu('rss_history?t=TV')" class="btn d-none d-sm-inline-block">
            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-history" width="24" height="24"
                 viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
                 stroke-linejoin="round">
              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
              <polyline points="12 8 12 12 14 14"></polyline>
              <path d="M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"></path>
            </svg>
            订阅历史
          </a>
          <a href="javascript:navmenu('rss_history?t=TV')" class="btn d-sm-none btn-icon" title="RSS解析器">
            <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-history" width="24" height="24"
                 viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
                 stroke-linejoin="round">
              <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
              <polyline points="12 8 12 12 14 14"></polyline>
              <path d="M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5"></path>
            </svg>
          </a>
        </div>
      </div>
    </div>
  </div>
</div>
{% if Count > 0 %}
  <div class="page-body">
    <div class="container-xl">
      <div class="row row-cards">
        {% for Id, Attr in Items.items() %}
          <div class="col-12 col-md-4 col-xl-3">
            <a class="card card-link card-link-pop rounded-3"
               href='javascript:{% if Attr.tmdbid %}show_mediainfo_modal("TV", "{{ Attr.name }}", "{{ Attr.year }}", "{{ Attr.tmdbid }}", "tv_rss", "{{ Attr.id }}"){% else %}show_edit_rss_media_modal("{{ Attr.id }}", "TV"){% endif %}'>
              <div class="text-center" style="overflow:hidden">
                <img class="rounded-top w-100" src="{{ Attr.image }}"
                     style="border-top-left-radius:var(--tblr-border-radius-lg) !important; border-top-right-radius:var(--tblr-border-radius-lg) !important; object-fit:cover; max-height:170px;">
              </div>
              <div class="card-progress" style="overflow: hidden">
                <div class="progress-bar bg-green"
                     style="width:{% if (Attr.total or -1) > 0 %}{{ ((Attr.total or -1)-(Attr.lack or -1))*100/(Attr.total or -1) }}{% endif %}%"
                     role="progressbar"
                     aria-valuenow="{% if (Attr.total or -1) > 0 %}{{ ((Attr.total or -1)-(Attr.lack or -1))*100/(Attr.total or -1) }}{% endif %}"
                     aria-valuemin="0" aria-valuemax="100">
                </div>
              </div>
              <div class="card-body text-center">
                <div class="card-title mb-1">
                  {% if Attr.year %}
                    {{ Attr.name }} ({{ Attr.year }}) {% if Attr.season != "S00" %}{{ Attr.season }}{% endif %}
                  {% else %}
                    {{ Attr.name }} {% if Attr.season != "S00" %}{{ Attr.season }}{% endif %}
                  {% endif %}
                </div>
                <div class="text-muted">
                  {% if Attr.state == 'D' %}
                    <span class="badge bg-gray"></span>  队列中
                  {% elif Attr.state == 'S' %}
                    <span class="badge bg-orange"></span>  正在搜索
                  {% elif Attr.state == 'R' %}
                    <span class="badge bg-green"></span>  正在订阅
                    {% if (Attr.total or -1) > 0 %}
                      ({{ (Attr.total or -1) - (Attr.lack or -1) }}/{{ (Attr.total or -1) }})
                    {% endif %}
                  {% else %}
                    <span class="badge bg-blue"></span>  完成
                  {% endif %}
                </div>
                <div{% if Attr.over_edition or
                      Attr.filter_restype or
                      Attr.filter_pix or
                      Attr.filter_team or
                      (Attr.download_setting and Attr.download_setting != -1) or
                      Attr.rss_sites or
                      Attr.search_sites %} class="text-muted border-top pt-2 mt-2"
                {% else %} class=“text-muted"{% endif %}>
                  <small>
                    {% if Attr.over_edition %}
                      <span class="badge badge-outline text-red me-1 mb-1" title="已开启洗版">洗版</span>
                    {% endif %}
                    {% if Attr.filter_restype %}
                      <span class="badge badge-outline text-orange me-1 mb-1" title="质量">
                        {{ Attr.filter_restype }}
                      </span>
                    {% endif %}
                    {% if Attr.filter_pix %}
                      <span class="badge badge-outline text-orange me-1 mb-1" title="分辨率">
                        {{ Attr.filter_pix }}
                      </span>
                    {% endif %}
                    {% if Attr.filter_rule|string in RuleGroups %}
                      <span class="badge badge-outline text-orange me-1 mb-1" title="过滤规则">
                        {{ RuleGroups[Attr.filter_rule|string] }}
                      </span>
                    {% endif %}
                    {% if Attr.download_setting != -1 and Attr.download_setting|string in DownloadSettings %}
                      <span class="badge badge-outline bg-cyan me-1 mb-1" title="下载设置">
                        {{ DownloadSettings[Attr.download_setting|string].name }}
                      </span>
                    {% endif %}
                    {% if Attr.filter_team %}
                      <span class="badge badge-outline text-blue me-1 mb-1 text-wrap text-start" title="制作组/字幕组">
                        {{ Attr.filter_team }}
                      </span>
                    {% endif %}
                  </small>
                </div>
                <div class="text-muted">
                  <small>
                    {% for Site in Attr.rss_sites %}
                      <span class="badge bg-lime me-1 mb-1" title="订阅站点">
                        {{ Site }}
                      </span>
                    {% endfor %}
                    {% for Site in Attr.search_sites %}
                      <span class="badge bg-yellow me-1 mb-1" title="搜索站点">
                        {{ Site }}
                      </span>
                    {% endfor %}
                  </small>
                </div>
              </div>
            </a>
          </div>
        {% endfor %}
      </div>
    </div>
  </div>
{% else %}
  <div class="page-body">
    <div class="container-xl d-flex flex-column justify-content-center">
      <div class="empty">
        <div class="empty-img"><img src="./static/img/sign_in.svg" height="128" alt="">
        </div>
        <p class="empty-title">没有记录</p>
        <p class="empty-subtitle text-muted">
          当前没有正在订阅的电视剧。
        </p>
      </div>
    </div>
  </div>
{% endif %}
